package ningbo.oop;

/**
 * @Author 宁铂
 * @Date 2021/7/13 22:47
 * @Version 1.0
 */
public class TestOOP {
    public static void main(String[] args) {
       Teacher teacher1 = new CGBTeacher("宁铂",22,10000000.0, "程序员");
       Teacher teacher2 = new ACTTeacher();

       teacher1.ready();
       teacher1.teach();

        System.out.println("姓名 "+teacher1.getName()+" 今年： "+teacher1.getAge()+" 工资： "+teacher1.getSalary()+" 从事： "+teacher1.getGender()+"工作");

    }
}

abstract class Teacher{

    private String name;
    private int age;
    private double salary;
    private String gender;

    public abstract void ready();

    public abstract void teach();

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public double getSalary() {
        return salary;
    }

    public void setSalary(double salary) {
        this.salary = salary;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public Teacher() {
        System.out.println("无参构造");
    }

    public Teacher(String name, int age, double salary, String gender) {
        System.out.println("全参构造");
        this.name = name;
        this.age = age;
        this.salary = salary;
        this.gender = gender;
    }
}

class CGBTeacher extends Teacher {

    public CGBTeacher(String name, int age, double salary, String gender) {
        super(name, age, salary, gender);
    }

    public void ready(){
        System.out.println("正在备CGB的课");
    }

    public void teach(){
        System.out.println("正在讲CGB的课");
    }
}

class ACTTeacher extends Teacher{
    public void ready(){
        System.out.println("正在备ACT的课");
    }

    public void teach(){
        System.out.println("正在讲ACT的课");
    }
}